
******************************************************************************
*
*                      Does War Improve Women's Political Representation
*
******************************************************************************

** This do-file provides the code to estimate the results reported in Figures of the main text and Tables of the supporting appendix.

// ssc install regsave
// ssc install estout
// ssc install reghdfe

global location ""
cd ""
use Data, clear


// cap log close
// log using "output.txt", text replace

xtset ccode year

******************************************************************
* Figure 2: Effect of war on the percentage of female legislators
******************************************************************


*** Panel 1

qui reghdfe f0s1.v2lgfemleg warDummy $control, a(ccode) cl(ccode)
	regsave warDummy using "$location/fig2", t p autoid addlabel(model, 1, type, 0) replace

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"

set more off
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg warDummy  $control , a(ccode) cl(ccode)
	regsave warDummy using "$location/fig2", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig2_panel1.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

*** Panels 2-4
	
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg newwar ongoingwar recentwar $control, a(ccode) cl(ccode)
	regsave newwar ongoingwar recentwar using "$location/fig2", t p autoid addlabel(model, `i', type, 2) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig2_panel2-4.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

*** Panel 5
	
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg wardur $control, a(ccode) cl(ccode)
	regsave wardur using "$location/fig2", t p autoid addlabel(model, `i', type, 3) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig2_panel5.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

*** Panel 6
	
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg ln_bdeaths $control, a(ccode) cl(ccode)
	regsave ln_bdeaths using "$location/fig2", t p autoid addlabel(model, `i', type, 4) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig2_panel6.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")


*** Panel 7
	
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg irregular_dummy $control, a(ccode) cl(ccode)
	regsave irregular_dummy using "$location/fig2", t p autoid addlabel(model, `i', type, 5) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


esttab using "$location/fig2_panel7.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")



******************************************************************
* Figure 3: War and women's empowerment and its components
******************************************************************

set more off
global control "s.polity2 l.polity2 s.lpec l.lpec year"

xtset ccode year
qui reghdfe f0s1.v2x_gender_6 warDummy L.v2x_gender $control sl.neighborv2x_gender_6, a(ccode) cl(ccode)
regsave warDummy using "$location/fig3", t p autoid addlabel(model, 1, dep, "drop") replace

foreach y of varlist v2x_gender_6 v2x_gencl_6 v2x_gencs_6 v2x_genpp_6 v2pepwrgen_6_re v2lgfemleg_6_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' warDummy L.`y' $control sl.neighbor`y', a(ccode) cl(ccode)
	regsave warDummy using "$location/fig3", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
esttab using "$location/fig3_`y'.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.`y' "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighbor`y' "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

}


******************************************************************
* Figure 4: Distinguishing between intrastate and interstate wars
******************************************************************

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"

*** Panel 1

global war "intra_warDummy inter_warDummy"

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)
	regsave $war using "$location/fig4", t p autoid addlabel(model, 1, type, 0) replace

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war $control, a(ccode) cl(ccode)
	regsave $war using "$location/fig4", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig4_panel1.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
*** Panels 2-4
global war "new_intrawar ongoingintra recentintra newinter ongoinginter recentinter"

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control, a(ccode) cl(ccode)
	regsave new_intrawar ongoingintra recentintra using "$location/fig4", t p autoid addlabel(model, `i', type, 2) append
	regsave newinter ongoinginter recentinter using "$location/fig4", t p autoid addlabel(model, `i', type, 3) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


esttab using "$location/fig4_panel2-4.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
*** Panel 5

global war "intrawardur"
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war $control, a(ccode) cl(ccode)
	regsave $war using "$location/fig4", t p autoid addlabel(model, `i', type, 4) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig4_panel5.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
*** Panel 6
global war "ln_intradeaths"

xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war $control, a(ccode) cl(ccode)
	regsave $war using "$location/fig4", t p autoid addlabel(model, `i', type, 5) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
	
esttab using "$location/fig4_panel6.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

**** Extra in 2nd revision ****	

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global war "intra_warDummy_post3 intra_warDummy"
global opt "if v_demo == 0"	

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global war "intra_warDummy_post3 intra_warDummy"
global opt "if v_demo == 1"	

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global control "s.polity2 l.polity2 s.lpec l.lpec year"
global opt "if v_demo == 0"	

xtset ccode year
qui reghdfe f0s1.v2x_gender_6 intra_warDummy L.v2x_gender $control sl.neighborv2x_gender_6 $opt, a(ccode) cl(ccode)

foreach y of varlist v2x_gender_6 v2x_gencl_6 v2x_gencs_6 v2x_genpp_6 v2pepwrgen_6_re v2lgfemleg_6_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' warDummy L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}

******************************************************************
* Figure 5
*****************************************************************

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global war "intra_warDummy_post3 intra_warDummy"

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)
regsave $war using "$location/fig5", t p autoid addlabel(model, 1, type, 0) replace

global opt ""

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/fig5", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig5_panel1.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")
	

global opt "if year>1984"

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/fig5", t p autoid addlabel(model, `i', type, 2) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
esttab using "$location/fig5_panel2.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
set more off
global opt "if e_regionpol=="E. Europe and C. Asia"" 
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo:  reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
 	regsave $war  using "$location/fig5", t p autoid addlabel(model, `i', type, 3) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig5_panel3.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
set more off
global opt "if e_regionpol=="Latin America"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/fig5", t p autoid addlabel(model, `i', type, 4) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig5_panel4.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")


set more off
global opt "if e_regionpol=="ME"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/fig5", t p autoid addlabel(model, `i', type, 5) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig5_panel5.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

set more off
global opt "if e_regionpol=="South Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/fig5", t p autoid addlabel(model, `i', type, 6) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig5_panel6.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

set more off
global opt "if e_regionpol=="South-East Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/fig5", t p autoid addlabel(model, `i', type, 7) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/fig5_panel7.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
set more off
global opt "if e_regionpol=="Sub-Saharan Africa""
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/fig5", t p autoid addlabel(model, `i', type, 8) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
	
esttab using "$location/fig5_panel8.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	rename(L.v2lgfemleg "Y\$ _{t-1} \$" S.polity2 "\$ \Delta \$ Polity score" L.polity2 "Polity score\$ _{t-1} \$"  S.lpec "\$ \Delta \$ Energy consumption" ///
	L.lpec "Energy consumption\$ _{t-1} \$" LS.neighborv2lgfemleg "\$ \Delta \$ Spatial lag\$ _{t-1} \$") ///	
	mtitle("Current" "1-year" "2-year" "3-year" "4-year" "5-year" "10-year" "15-year") ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
******************************************************************
* Figure 6
*****************************************************************


global control "s.polity2 l.polity2 s.lpec l.lpec year"
global opt "if e_regionpol=="Sub-Saharan Africa""
global war "intra_warDummy_post3 intra_warDummy"

qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/fig6a", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/fig6a", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}


global control "s.polity2 l.polity2 s.lpec l.lpec year"
global opt "if e_regionpol!="Sub-Saharan Africa""
global war "intra_warDummy_post3 intra_warDummy"

qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/fig6b", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/fig6b", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}


	
******************************************************************
* Supporting Appendix
*****************************************************************

*** Figure A5

global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "vquota_adoption"
global opt ""	

qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/figA5", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA5", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}

*** Figure A6


global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "vquota_adoption"
global opt "if v_demo == 1"	

qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/figA6", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA6", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}


*** Figure A7

set more off
global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "warDummy"

xtset ccode year
qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender, a(ccode) cl(ccode)
regsave $war using "$location/figA7", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y', a(ccode) cl(ccode)
	regsave $war using "$location/figA7", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}


*** Figure A8

global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "inter_warDummy intra_warDummy"
global opt ""


qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender, a(ccode) cl(ccode)
regsave $war using "$location/figA8", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA8", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}

*** Figure A9
global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "inter_warDummy intra_warDummy"

qui  reghdfe f0s1.v2x_gender_6 $war L.v2x_gender $control sl.neighborv2x_gender_6, a(ccode) cl(ccode)
regsave $war using "$location/figA9", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender_6 v2x_gencl_6 v2x_gencs_6 v2x_genpp_6 v2pepwrgen_6_re v2lgfemleg_6_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA9", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}


*** Figure A10

global control "warDummy s.polity2 l.polity2 s.lpec l.lpec year"
global war "irregular_dummy"
global opt ""	
qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/figA10", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA10", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}

*** Figure A11


global control "warDummy s.polity2 l.polity2 s.lpec l.lpec year"
global war "vdemo_trans"
global opt ""	
qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/figA11", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA11", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}

*** Figure A12

global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "warDummy"
global opt "if v_demo == 0"	

qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/figA12", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA12", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}

*** Figure A13

global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "warDummy"
global opt "if v_demo == 1"	

qui reghdfe f0s1.v2x_gender $war L.v2x_gender $control sl.neighborv2x_gender $opt, a(ccode) cl(ccode)
regsave $war using "$location/figA13", t p autoid addlabel(model, 1, dep, "drop") replace

xtset ccode year
foreach y of varlist v2x_gender v2x_gencl v2x_gencs v2x_genpp v2pepwrgen_re v2lgfemleg_re {
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.`y' $war L.`y' $control sl.neighbor`y' $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA13", t p autoid addlabel(model, `i', dep, `y') append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
}


*** Figure A15


global control2 "L.female_core_share s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global opt ""

	
global control2 "L.female_core_share s.polity2 l.polity2 s.lpec l.lpec sl.neighborfemale_core_share year"

xtset ccode year
qui reghdfe f0s1.female_core_share  warDummy $control2, a(ccode) cl(ccode)
regsave warDummy using "$location/figA15", t p autoid addlabel(model, 1, type, 0) replace

set more off
xtset ccode year 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.female_core_share warDummy $control2, a(ccode) cl(ccode)
	regsave warDummy using "$location/figA15", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
	
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
local j= `i'+1
eststo: qui reghdfe f`i's`j'.female_core_share intra_warDummy inter_warDummy  $control2, a(ccode) cl(ccode)
regsave intra_warDummy inter_warDummy using "$location/figA15", t p autoid addlabel(model, `i', type, 2) append

}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
		
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
local j= `i'+1
eststo: qui reghdfe f`i's`j'.female_core_share new_intrawar ongoingintra recentintra newinter ongoinginter recentinter  $control2, a(ccode) cl(ccode)
regsave new_intrawar ongoingintra recentintra using "$location/figA15", t p autoid addlabel(model, `i', type, 3) append

}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
	
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.female_core_share intrawardur $control2, a(ccode) cl(ccode)
	regsave intrawardur using "$location/figA15", t p autoid addlabel(model, `i', type, 6) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

	
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.female_core_share ln_intradeaths  $control2, a(ccode) cl(ccode)
	regsave ln_intradeaths using "$location/figA15", t p autoid addlabel(model, `i', type, 7) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.female_core_share irregular_dummy $control2, a(ccode) cl(ccode)
	regsave irregular_dummy using "$location/figA15", t p autoid addlabel(model, `i', type, 8) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


*** Figure A16

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global war "recentintra intra_warDummy"

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)
regsave $war using "$location/figA16", t p autoid addlabel(model, 1, type, 0) replace

global opt ""

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA16", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
	
global opt "if year>1984"

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA16", t p autoid addlabel(model, `i', type, 2) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
		

set more off
global opt "if e_regionpol=="E. Europe and C. Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA16", t p autoid addlabel(model, `i', type, 3) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

set more off
global opt "if e_regionpol=="Latin America"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA16", t p autoid addlabel(model, `i', type, 4) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if e_regionpol=="ME"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA16", t p autoid addlabel(model, `i', type, 5) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if e_regionpol=="South Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA16", t p autoid addlabel(model, `i', type, 6) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if e_regionpol=="South-East Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA16", t p autoid addlabel(model, `i', type, 7) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

set more off
global opt "if e_regionpol=="Sub-Saharan Africa""
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA16", t p autoid addlabel(model, `i', type, 8) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


*** Figure A17

global war "intra_warDummy_post5 intra_warDummy"
global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)
regsave $war using "$location/figA17", t p autoid addlabel(model, 1, type, 0) replace

global opt ""

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA17", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
	
global opt "if year>1984"

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA17", t p autoid addlabel(model, `i', type, 2) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
		

set more off
global opt "if e_regionpol=="E. Europe and C. Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA17", t p autoid addlabel(model, `i', type, 3) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

set more off
global opt "if e_regionpol=="Latin America"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA17", t p autoid addlabel(model, `i', type, 4) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if e_regionpol=="ME"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA17", t p autoid addlabel(model, `i', type, 5) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if e_regionpol=="South Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA17", t p autoid addlabel(model, `i', type, 6) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if e_regionpol=="South-East Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA17", t p autoid addlabel(model, `i', type, 7) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

set more off
global opt "if e_regionpol=="Sub-Saharan Africa""
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA17", t p autoid addlabel(model, `i', type, 8) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted



*** Figure A18

global control "s.v2lgfemleg L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global war "intra_warDummy_post3 intra_warDummy"
global opt "if l.vquota== 0"

set more off
qui reghdfe f0.vquota $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA18", t p autoid addlabel(model, `i', type, 0) replace

xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i'.vquota $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA18", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


global opt "if l.vquota== 0 &  year>1984"
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i'.vquota $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA18", t p autoid addlabel(model, `i', type, 2) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

set more off
global opt "if l.vquota== 0 & e_regionpol=="E. Europe and C. Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA18", t p autoid addlabel(model, `i', type, 3) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

set more off
global opt "if l.vquota== 0 & e_regionpol=="Latin America"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA18", t p autoid addlabel(model, `i', type, 4) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if l.vquota== 0 & e_regionpol=="ME"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA18", t p autoid addlabel(model, `i', type, 5) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if l.vquota== 0 & e_regionpol=="South Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA18", t p autoid addlabel(model, `i', type, 6) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


set more off
global opt "if l.vquota== 0 & e_regionpol=="South-East Asia"" 
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/figA18", t p autoid addlabel(model, `i', type, 7) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

set more off
global opt "if l.vquota== 0 & e_regionpol=="Sub-Saharan Africa""
xtset ccode year
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA18", t p autoid addlabel(model, `i', type, 8) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted



*** Figure A19

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global opt "if e_regionpol=="Sub-Saharan Africa""
global war "trans_intra_warDummy_post3 notrans_intra_warDummy_post3 intra_warDummy"

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)
regsave $war using "$location/figA19a", t p autoid addlabel(model, 1, type, 0) replace

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA19a", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
		
global war "trans2_intra_warDummy_post3 notrans2_intra_warDummy_post3 intra_warDummy"

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)
regsave $war using "$location/figA19b", t p autoid addlabel(model, 1, type, 0) replace

global opt ""

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA19b", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
	
	
global war "irregular_intra_warDummy_post3 noirregular_intra_warDummy_post3 intra_warDummy"

set more off
qui reghdfe f0s1.v2lgfemleg $war $control, a(ccode) cl(ccode)
regsave $war using "$location/figA19c", t p autoid addlabel(model, 1, type, 0) replace

eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
	regsave $war  using "$location/figA19c", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted


foreach x of any fig3 fig6 figA5 figA6 figA7  figA8 figA9 figA10 figA11 figA12 figA13 figA20 figA21  {
preserve
use "$location/`x'", clear
sort _id
drop if dep == "drop"
save, replace
restore
}

foreach x of any fig2 fig4 fig5    figA15 figA16 figA17 figA18 figA19a figA19b figA19c {
preserve
use "$location/`x'", clear
sort _id
drop if type == 0
save, replace
restore
}



*** Table A1

eststo clear
preserve
keep if election == 1
eststo: qui reghdfe Dv2lgfemleg intra_end intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post2_intra_end intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post3_intra_end intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post4_intra_end intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post5_intra_end intra_warDummy change_*  lag* year Lv2lgfemleg, a(ccode) cl(ccode)
restore 

esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/election1.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	order(intra_end post2_intra_end post3_intra_end post4_intra_end post5_intra_end intra_warDummy) ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

*** Table A2
	
eststo clear
preserve
keep if election == 1
eststo: qui reghdfe Dv2lgfemleg intra_warDummy_post3 intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post2_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post3_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post4_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post5_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

esttab using "$location/election2.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	order(intra_warDummy_post3 post2_intra_end_nowar post3_intra_end_nowar post4_intra_end_nowar post5_intra_end_nowar intra_warDummy) ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")
restore 

*** Table A3

eststo clear
preserve
keep if election == 1 & e_regionpol=="Sub-Saharan Africa"
eststo: qui reghdfe Dv2lgfemleg intra_warDummy_post3 intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post2_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post3_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post4_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post5_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
restore 
esttab using "$location/election3.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	order(intra_warDummy_post3 post2_intra_end_nowar post3_intra_end_nowar post4_intra_end_nowar post5_intra_end_nowar intra_warDummy) ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

*** Table A4

eststo clear	
preserve
keep if election == 1 & e_regionpol!="Sub-Saharan Africa"
eststo: qui reghdfe Dv2lgfemleg intra_warDummy_post3 intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post2_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post3_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post4_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
eststo: qui reghdfe Dv2lgfemleg post5_intra_end_nowar intra_warDummy change_* lag* year Lv2lgfemleg, a(ccode) cl(ccode)
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted
restore 

esttab using "$location/election4.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles  ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	order(intra_warDummy_post3 post2_intra_end_nowar post3_intra_end_nowar post4_intra_end_nowar post5_intra_end_nowar intra_warDummy) ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

*** Table A5	

use "Data_BB.dta"

xtset gwno year
eststo clear 
global opt "if year >= 1975, pairwise"
eststo: qui xtpcse ch_inst_emp postmajor2 postminor2 major minor time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui xtpcse ch_inst_emp postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui xtpcse ch_inst_emp postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
global opt "if year >= 1975 & e_regionpol==4, pairwise"
eststo: qui xtpcse ch_inst_emp postmajor2 postminor2 major minor time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui xtpcse ch_inst_emp postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui xtpcse ch_inst_emp postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
global opt "if year >= 1975& e_regionpol!=4, pairwise"
eststo: qui xtpcse ch_inst_emp postmajor2 postminor2 major minor time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui xtpcse ch_inst_emp postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui xtpcse ch_inst_emp postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
esttab , star(* 0.10 ** 0.05 *** 0.01) label ///
	order(postmajor2 postminor2 postpa2 postother2 postmajor2 postpagender2 postnogender2 postother2 major minor conflictdummy) 

esttab using "$location/BB.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	mgroups("Full sample" "SSF only" "Excluding SSF", pattern(1 0 0 1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	order(postmajor2 postminor2 postpa2 postother2 postmajor2 postpagender2 postnogender2 postother2 major minor conflictdummy) ///
	stats(N_g N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")
	
*** Table A6	

eststo clear 
global opt "if year >= 1975, a(gwno) cl(gwno)"
eststo: qui reghdfe ch_inst_emp postmajor2 postminor2 major minor time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui reghdfe ch_inst_emp postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui reghdfe ch_inst_emp postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
global opt "if year >= 1975 & e_regionpol==4, a(gwno) cl(gwno)"
eststo: qui reghdfe ch_inst_emp postmajor2 postminor2 major minor time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui reghdfe ch_inst_emp postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui reghdfe ch_inst_emp postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
global opt "if year >= 1975 & e_regionpol!=4, a(gwno) cl(gwno)"
eststo: qui reghdfe ch_inst_emp postmajor2 postminor2 major minor time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui reghdfe ch_inst_emp postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
eststo: qui reghdfe ch_inst_emp postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lag_inst_emp $opt
esttab , star(* 0.10 ** 0.05 *** 0.01) label ///
	order(postmajor2 postminor2 postpa2 postother2 postmajor2 postpagender2 postnogender2 postother2 major minor conflictdummy) 

esttab using "$location/BB2.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles ///
	star(+ .1 * .05 ** .01) substitute(\_ _)  ///
	mgroups("Full sample" "SSF only" "Excluding SSF", pattern(1 0 0 1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	order(postmajor2 postminor2 postpa2 postother2 postmajor2 postpagender2 postnogender2 postother2 major minor conflictdummy) ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")

	
*** Table A7


global opt "if year >= 1975, pairwise"
	
set more off	
xtset gwno year
eststo clear 
eststo: qui xtpcse d.v2lgfemleg postmajor2 postminor2 major minor time lag_gdppc lag_education lv2lgfemleg $opt
eststo: qui xtpcse d.v2lgfemleg postpa2 postother2 postmajor2 conflictdummy time lag_gdppc lag_education lv2lgfemleg $opt
eststo: qui xtpcse d.v2lgfemleg postpagender2 postnogender2 postother2 postmajor2 conflictdummy time lag_gdppc lag_education lv2lgfemleg $opt

global opt "if year >= 1975 & e_regionpol==4, pairwise"
eststo: qui xtpcse d.v2lgfemleg postmajor2 postminor2 major minor time lag_gdppc lag_education lv2lgfemleg $opt
eststo: qui xtpcse d.v2lgfemleg postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lv2lgfemleg $opt
eststo: qui xtpcse d.v2lgfemleg postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lv2lgfemleg $opt

global opt "if year >= 1975& e_regionpol!=4, pairwise"
eststo: qui xtpcse d.v2lgfemleg postmajor2 postminor2 major minor time lag_gdppc lag_education lv2lgfemleg $opt
eststo: qui xtpcse d.v2lgfemleg postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lv2lgfemleg $opt
eststo: qui xtpcse d.v2lgfemleg postpagender2 postnogender2 postother2 postmajor2 conflictd time lag_gdppc lag_education lv2lgfemleg $opt
esttab , star(* 0.10 ** 0.05 *** 0.01) label ///
	order(postmajor2 postminor2 postpa2 postother2 postmajor2 postpagender2 postnogender2 postother2 major minor conflictdummy) 

esttab using "$location/BB3.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	mgroups("Full sample" "SSF only" "Excluding SSF", pattern(1 0 0 1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 	
	order(postmajor2 postminor2 postpa2 postother2 postmajor2 postpagender2 postnogender2 postother2 major minor conflictdummy) ///
	stats(N_g N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")
	

*** Table A8

set more off	
xtset gwno year
eststo clear 
global opt "if year >= 1975, a(gwno) cl(gwno)"
	eststo: qui reghdfe d.v2lgfemleg postmajor2 postminor2 major minor time lag_gdppc lag_education lv2lgfemleg $opt
	eststo: qui reghdfe d.v2lgfemleg postpa2 postother2 postmajor2 conflictdummy time lag_gdppc lag_education lv2lgfemleg $opt
	eststo: qui reghdfe d.v2lgfemleg postpagender2 postnogender2 postother2 postmajor2 conflictdummy time lag_gdppc lag_education lv2lgfemleg $opt
global opt "if year >= 1975  & e_regionpol==4, a(gwno) cl(gwno)"
	eststo: qui reghdfe d.v2lgfemleg postmajor2 postminor2 major minor time lag_gdppc lag_education lv2lgfemleg $opt
	eststo: qui reghdfe d.v2lgfemleg postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lv2lgfemleg $opt
	eststo: qui reghdfe d.v2lgfemleg postpagender2 postnogender2 postother2 postmajor2 conflictdummy time lag_gdppc lag_education lv2lgfemleg $opt
global opt "if year >= 1975  & e_regionpol!=4, a(gwno) cl(gwno)"
	eststo: qui reghdfe d.v2lgfemleg postmajor2 postminor2 major minor time lag_gdppc lag_education lv2lgfemleg $opt
	eststo: qui reghdfe d.v2lgfemleg postpa2 postother2 postmajor2 conflictd time lag_gdppc lag_education lv2lgfemleg $opt
	eststo: qui reghdfe d.v2lgfemleg postpagender2 postnogender2 postother2 postmajor2 conflictdummy time lag_gdppc lag_education lv2lgfemleg $opt
esttab , star(* 0.10 ** 0.05 *** 0.01) label

esttab using "$location/BB4.tex", replace b(3) se(3) label eqlabels(none) booktabs nonotes noomitted nobase nodepvars nomtitles ///
	star(+ .1 * .05 ** .01) substitute(\_ _) ///
	mgroups("Full sample" "SSF only" "Excluding SSF", pattern(1 0 0 1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 	
	order(postmajor2 postminor2 postpa2 postother2 postmajor2 postpagender2 postnogender2 postother2 major minor conflictdummy) ///
	stats(N_clust N, fmt(0 0) labels("Countries" "N")) prefoot(" \addlinespace") postfoot("\bottomrule \end{tabular}}")


	
*** Figure A20

global location "/Users/nk/Dropbox/DATA/Gender/IO-women-empowerment-master/NK replication/Results"
cd "/Users/nk/Dropbox/DATA/Gender/IO-women-empowerment-master/NK replication" 
use Data, clear


global control "s.polity2 l.polity2 s.lpec l.lpec year"
global war "pa_end"
global opt ""

qui reghdfe f0s1.v2lgfemleg $war $control $opt, a(ccode) cl(ccode)
	regsave $war using "$location/BB5", t p autoid addlabel(model, 1, type, 0) replace

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"

set more off
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
 	regsave $war using "$location/BB5", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

global opt "if e_regionpol=="Sub-Saharan Africa"" 

qui reghdfe f0s1.v2lgfemleg $war $control $opt, a(ccode) cl(ccode)
 	regsave $war using "$location/BB6", t p autoid addlabel(model, 1, type, 0) replace

set more off
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
 	regsave $war using "$location/BB6", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"
global war "pagender_end postother_end "

qui reghdfe f0s1.v2lgfemleg $war $control $opt, a(ccode) cl(ccode)
 	regsave pagender_end using "$location/BB7", t p autoid addlabel(model, 1, type, 0) replace

set more off
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
 	regsave pagender_end using "$location/BB7", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

global opt "if e_regionpol=="Sub-Saharan Africa"" 

qui reghdfe f0s1.v2lgfemleg $war $control $opt, a(ccode) cl(ccode)
 	regsave pagender_end using "$location/BB8", t p autoid addlabel(model, 1, type, 0) replace

global control "L.v2lgfemleg s.polity2 l.polity2 s.lpec l.lpec sl.neighborv2lgfemleg year"

set more off
eststo clear
foreach i of numlist 0 1 2 3 4 5 10 15 {
	local j= `i'+1
	eststo: qui reghdfe f`i's`j'.v2lgfemleg $war  $control $opt, a(ccode) cl(ccode)
 	regsave pagender_end using "$location/BB8", t p autoid addlabel(model, `i', type, 1) append
}
esttab , star(* 0.10 ** 0.05 *** 0.01)  label  b(3) se(3)  nobase noomitted

